using System;
using System.Collections.Generic;
using System.Text;
using SP.Parameter;

namespace SP.HwLowProfileRS
{
    /// <summary>
    /// A simple base map feature
    /// </summary>
    public class BaseMapFusion : AbstractFusion
    {
        public BaseMapFusion()
        {
            // param baseMap
            AddParameter(
                new Texture2dParamter("baseMap", "baseMapSamp")
                .SetSRGBTexture(true)
                .SetDesc("UV channel 1; RGB: diffuse; A: unused")
                .SetForceSamplerId(0)
                );
        }

        public override string Name
        {
            get { return "BaseMap"; }
        }

        public override string Desc
        {
            get { return ""; }
        }

        public override Stage Stage
        {
            get { return Stage.AlbedoGloss; }
        }

        public override int UVChannelCount
        {
            get { return 1; }
        }

        public override void Code(StringBuilder b, string platform)
        {
            AddLine(b, "vec4 baseMap = tex2D(baseMapSamp, pipeline.Texcoord[0]);");
            AddLine(b, "pipeline.Albedo *= baseMap.rgb;");
        }
    }
}
